package com.hsjk.szwj.module.train.controller.admin;

import com.hsjk.szwj.framework.common.pojo.CommonResult;
import com.hsjk.szwj.framework.common.pojo.PageResult;
import com.hsjk.szwj.module.train.controller.admin.vo.AdminOrderPageReqVO;
import com.hsjk.szwj.module.train.controller.admin.vo.AdminOrderPageRespVO;
import com.hsjk.szwj.module.train.service.IOrderService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

import static com.hsjk.szwj.framework.common.pojo.CommonResult.success;

/**
 * @author chenjiawei
 * @desc
 * @Date 2023/10/11 23:23
 **/
@Tag(name = "后台管理端 - 订单相关接口")
@RestController
@RequestMapping("/train/order")
@Validated
public class AdminOrderController {
    @Resource
    private IOrderService orderService;


    @PostMapping("/page-order")
    @Operation(summary = "获取订单分页列表")
    @PreAuthorize("@ss.hasPermission('train:order:query')")
    public CommonResult<PageResult<AdminOrderPageRespVO>> getAdminOrderPage(@RequestBody @Valid AdminOrderPageReqVO reqVO) {
        return success(orderService.getAdminOrderPage(reqVO));
    }
}
